package io.cloud.tec.project.web;

import io.cloud.tec.project.component.DistributedLock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("api")
public class RedissonController {

    @Autowired
    DistributedLock distributedLock;

    @GetMapping("dlA")
    public void dstributedLockA() {
        distributedLock.getLock("test", 5, -1);
    }


    @GetMapping("dlB")
    public void dstributedLockB() {
        distributedLock.getLock("test", 5, -1);
    }

    // A 获取后，B获取等待30s
    // A 超时 20，不解锁
}
